import net.optix.ip.model.ModelLocator;
import net.optix.ip.vo.CopyrightVO;

import views.ViewInstance;
[Bindable]
private var model:ModelLocator	=	ModelLocator.getInstance();

public var _copyright:CopyrightVO;

public function set copyright(value:CopyrightVO):void
{
	_copyright	=	value;
	var isVisible:Boolean	=	false;
	
	if(model.role > 0 && model.role <3)
	{
		this.label	=	"Add New Action";
	}
	else
	{
		this.label	=	"Post Document/Record Action";
	}
	
	switch(model.role)
	{
		case 1:
			if(model.client.clientID == _copyright.clientID)
			{
				isVisible	=	true;
				this.label	=	"Add New Action";
			}
			break;
		case 2:
			if(model.inventor.inventorID == _copyright.inventorID)
			{
				isVisible	=	true;
				this.label	=	"Post Document/Record Action";
			}
			break;
		case 3:
			if(model.firm.firmID == _copyright.firmID && _copyright.bConfirm == 1)
			{
				isVisible	=	true;
				this.label	=	"Post Document/Record Action";
			}
			else
			{
				isVisible	=	false;
				this.label	=	"Post Document/Record Action";
			}
			break;
		case 4:
			if(model.practitioner.practitionerID == _copyright.practitionerID && _copyright.bConfirm == 1)
			{
				isVisible	=	true;
				this.label	=	"Post Document/Record Action";
			}
			else
			{
				isVisible	=	false;
				this.label	=	"Post Document/Record Action";
			}
			break;
	}
	
	this.enabled	=	isVisible;
	
}
public function get copyright():CopyrightVO
{
	return _copyright;
}

private function addAction(event:MouseEvent):void
{			
	model.actionView	=	0;
	model.actionView	=	ViewInstance.AddCopyrightAction;
}